<%@ page import="org.openehr.am.archetype.constraintmodel.*" %>


<%--
// in: cDvOrdinal (${cDvOrdinal.class}) (${cDvOrdinal.rmTypeName})<br/>
--%>

<b>${cDvOrdinal.path()}</b>

<%--
<g:each in="${cDvOrdinal.list}">
${it.value} ${it.symbol.class}-- CodePhrase
</g:each>
--%>


<%-- ${archetype.ontology} --%>

<!-- armo lista de valores con textos -->
<g:set var="values" value="${[]}" />
<g:each in="${cDvOrdinal.list.sort{ it.value }}" var="ordinal">
  <g:set var="archetypeTerm" value="${archetype.ontology.termDefinition(session.locale.language, ordinal.symbol.codeString)}" />
    <g:if test="${!archetypeTerm}">
    El termino con codigo [${ordinal.symbol.codeString}] no esta definido en el arquetipo, posiblemente el termino no esta definido para el lenguaje seleccionado.<br/>
  </g:if>
  <g:else>
    <% values << archetypeTerm.items.text %>
  </g:else>
</g:each>

<%--
${archetype.ontology.termDefinition("es", (cDvOrdinal.list as List)[0].symbol.codeString)}
${(cDvOrdinal.list as List)[0].symbol.codeString}
--%>

<g:select from="${values}"
          keys="${cDvOrdinal.list.sort{ it.value }.symbol.codeString}"
          name="${archetype.archetypeId.value+cDvOrdinal.path()}"
          noSelection="${['':'']}" />

<g:parentElementIsMultiple archetypeId="${archetype.archetypeId.value}" nodePath="${cDvOrdinal.path()}">
      <div class="multiple">
        <a href="#" class="clone">Agregar entrada</a>
      </div>
    </g:parentElementIsMultiple>